(*version)++;
}
-static inline void __update_dom_time(struct vcpu *v)
+static inline void __update_vcpu_system_time(struct vcpu *v)
{
struct cpu_time *t;
struct vcpu_time_info *u;
version_update_end(&u->version);
}
-void update_dom_time(struct vcpu *v)
+void update_vcpu_system_time(struct vcpu *v)
{
if ( v->domain->shared_info->vcpu_info[v->vcpu_id].time.tsc_timestamp !=
cpu_time[smp_processor_id()].local_tsc_stamp )
- __update_dom_time(v);
+ __update_vcpu_system_time(v);
+}
+
+void update_domain_wallclock_time(struct domain *d)
+{
+ spin_lock(&wc_lock);
+ version_update_begin(&d->shared_info->wc_version);
+ d->shared_info->wc_sec = wc_sec;
+ d->shared_info->wc_nsec = wc_nsec;
+ version_update_end(&d->shared_info->wc_version);
+ spin_unlock(&wc_lock);
}
/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
u64 x;
u32 y, _wc_sec, _wc_nsec;
struct domain *d;
- shared_info_t *s;
x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
y = do_div(x, 1000000000);
+ spin_lock(&wc_lock);
wc_sec = _wc_sec = (u32)x;
wc_nsec = _wc_nsec = (u32)y;
+ spin_unlock(&wc_lock);
read_lock(&domlist_lock);
- spin_lock(&wc_lock);
-
for_each_domain ( d )
- {
- s = d->shared_info;
- version_update_begin(&s->wc_version);
- s->wc_sec = _wc_sec;
- s->wc_nsec = _wc_nsec;
- version_update_end(&s->wc_version);
- }
-
- spin_unlock(&wc_lock);
+ update_domain_wallclock_time(d);
read_unlock(&domlist_lock);
}
-void init_domain_time(struct domain *d)
-{
- spin_lock(&wc_lock);
- version_update_begin(&d->shared_info->wc_version);
- d->shared_info->wc_sec = wc_sec;
- d->shared_info->wc_nsec = wc_nsec;
- version_update_end(&d->shared_info->wc_version);
- spin_unlock(&wc_lock);
-}
-
static void local_time_calibration(void *unused)
{
unsigned int cpu = smp_processor_id();
/* Ensure that the domain has an up-to-date time base. */
if ( !is_idle_vcpu(next) )
{
- update_dom_time(next);
+ update_vcpu_system_time(next);
if ( next->sleep_tick != schedule_data[cpu].tick )
send_timer_event(next);
}
if ( !is_idle_vcpu(v) )
{
- update_dom_time(v);
+ update_vcpu_system_time(v);
send_timer_event(v);
}
{
struct vcpu *v = data;
- update_dom_time(v);
+ update_vcpu_system_time(v);
send_timer_event(v);
}
#define MILLISECS(_ms) ((s_time_t)((_ms) * 1000000ULL))
#define MICROSECS(_us) ((s_time_t)((_us) * 1000ULL))
-extern void update_dom_time(struct vcpu *v);
+extern void update_vcpu_system_time(struct vcpu *v);
+extern void update_domain_wallclock_time(struct domain *d);
+
extern void do_settime(
unsigned long secs, unsigned long nsecs, u64 system_time_base);